package com.cloudbroker.bcs.platform.dav.middle.bizservice.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.base.vo.HSBCPSVO;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.connect.CommonConnectTestBizService;
import com.cloudbroker.bcs.platform.dav.bizapi.service.common.connect.result.ConnectResult;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.BusinessConnectTestT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.chat.ChatConnectTestT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.export.ExportConnectTestT2BizService;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.viewpoint.ViewpointConnectTestT2BizService;

@Service
public class CommonConnectTestBizServiceImpl implements CommonConnectTestBizService {
    
    @Resource
    private BusinessConnectTestT2BizService businessConnectTestT2;
    @Resource
    private ChatConnectTestT2BizService chatConnectTestT2;
    @Resource
    private ExportConnectTestT2BizService exportConnectTestT2;
    @Resource
    private ViewpointConnectTestT2BizService viewpointConnectTestT2;
//    @Resource
//    private OperateFundT2BizService operateFundT2;
    
    @Override
    public ConnectResult funcCommonConnectTest(HSBCPSVO form) {
        StringBuilder msgBuilder = new StringBuilder();
        try {
            businessConnectTestT2.funcBusinessConnectTest(form);
            msgBuilder.append("business连接成功！");
        } catch (Exception e) {
            msgBuilder.append("business连接错误！");
        }
        try {
            chatConnectTestT2.funcChatConnectTest(form);
            msgBuilder.append("chat连接成功！");
        } catch (Exception e) {
            msgBuilder.append("chat连接错误！");
        }
        try {
            exportConnectTestT2.funcExportConnectTest(form);
            msgBuilder.append("export连接成功！");
        } catch (Exception e) {
            msgBuilder.append("export连接错误！");
        }
        try {
            viewpointConnectTestT2.funcViewpointConnectTest(form);
            msgBuilder.append("viewpoint连接成功！");
        } catch (Exception e) {
            msgBuilder.append("viewpoint连接错误！");
        }
//        try {
//            operateFundT2.funcOperateConnectTest(form);
//            msgBuilder.append("operate连接成功！");
//        } catch (Exception e) {
//            msgBuilder.append("operate连接错误！");
//        }
        ConnectResult result = new ConnectResult();
        result.setMessage(msgBuilder.toString());
        return VOUtil.setSuccessResult(result);
    }
    
}
